<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/vue.js"></script>
</head>
<body>
    <div id="app">
        <h2 :ref="weather">今天天气真不错</h2>
        <button @click="handle">按钮</button>
    </div>
    <script>
        const VM = new Vue({
            el:'#app',
            data:{
                weather:'w'
            },
            methods:{
                handle(){
                    alert(this.$refs[this.weather].innerHTML);
                    console.log(this.$refs[this.weather].style.color='red');
                }
            }
        });
    </script>
</body>
</html>